package setup

import (
	"github.com/gin-gonic/gin"
	"my-gin-tiktok/app/middlewares"
	"my-gin-tiktok/app/routers"
	"my-gin-tiktok/global"
)

func InitRouter() *gin.Engine {
	router := gin.Default()

	if global.App.Config.App.Env == "production" {
		gin.SetMode(gin.ReleaseMode)
	}

	router.Use(middlewares.Cors())
	routerGroup := router.Group("/api/v1")
	routers.InitUploadRouter(routerGroup)
	routers.InitUserRouter(routerGroup)
	routers.InitVideoRouter(routerGroup)
	routers.InitRelationRouter(routerGroup)
	routers.InitFavoriteRouter(routerGroup)
	routers.InitCommentRouter(routerGroup)
	return router
}
